package com.leyou.order.config;

import com.leyou.common.utils.IdWorker;
import com.leyou.order.properties.IdWorkerProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by IntelliJ IDEA.
 *
 * @author: wangzibeng
 * Date: 2019/5/20 0020
 * Time: 14:01
 */

@Configuration
public class IdWorkerConfig {
    @Bean
    public IdWorker idWorker(IdWorkerProperties properties) {
        return new IdWorker(properties.getWorkerId(), properties.getDataCenterId());
    }
}
